<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>新手任务</title>
        <meta name="viewport" content="initial-scale=1, maximum-scale=1">
        <!--<link rel="shortcut icon" href="/favicon.ico">-->
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">

        <link rel="stylesheet" href="<?php echo C('STATIC_SHORT_URL');?>/mobile/css/common.css?v=1.0">
        <link rel="stylesheet" href="<?php echo C('STATIC_SHORT_URL');?>/mobile/css/new_task.css?v=1.0">
    </head>
    <body>

        <div class="content pull-to-refresh-content" data-ptr-distance="55">
            <!--主要部分-->
            <section>
                <div class="banner">
                    <img src="__IMAGES__/activity/new/banner.png" style="width: 100%;height:100%;display: block; " >
                </div>
                <div class="main">
                    <ul class="part1">
                        <li>
                            <img src="__IMAGES__/activity/new/sc.png" style="width: 7.02rem;height:1.5rem;line-height:1.5rem;display: block; margin-bottom:0.4rem" >
                            <?php if($is_change_img){ ?>
                            <a href="javascript:;" class="li_a" style="top:0.6rem" >
                                <img src="__IMAGES__/activity/new/ok.png" class="pho1">
                            </a>
                            <?php }else{ ?>
                            <a href="honglu://www.honglu.com/native_new?i_name=ExitLoginVC&a_name=SettingActivity&need_login=1" class="li_a" style="top:0.6rem" >
                            <img src="__IMAGES__/activity/new/go.png"class="pho2" >    
                            </a>
                            <?php } ?>
                        </li>
                        <li>
                            <img src="__IMAGES__/activity/new/chang.png" style="width: 7.02rem;height:1.32rem;display: block;margin-bottom:0.1rem">
                            <?php if($is_change_name){ ?>
                            <a href="javascript:;" class="li_a" style="top:0.45rem" >
                                <img src="__IMAGES__/activity/new/ok.png" class="pho1">
                            </a>
                            <?php }else{ ?>
                            <a href="honglu://www.honglu.com/native_new?i_name=ExitLoginVC&a_name=SettingActivity&need_login=1" class="li_a" style="top:0.45rem" >
                            <img src="__IMAGES__/activity/new/go.png"class="pho2" >
                            </a>
                            <?php } ?>
                        </li>
                        <li>
                            <img src="__IMAGES__/activity/new/read.png" style="width: 7.02rem;height:1.62rem;display: block">
                            <?php if($count_topic){ ?>
                            <a href="javascript:;" class="li_a" style="top:0.72rem" >
                                <img src="__IMAGES__/activity/new/ok.png"class="pho1" >
                            </a>
                            <?php }else{ ?>
                            <a href="honglu://www.honglu.com/native_new?i_name=CircleComposeVC&a_name=PublishActivity&need_login=1" class="li_a" style="top:0.72rem" >
                            <img src="__IMAGES__/activity/new/go.png" class="pho2">
                            </a>
                            <?php } ?>
                        </li>
                    </ul>
                    <div class="part2">
                        <?php if($count_log){ ?>
                        <a href="javascript:;" class="li_a" style="top:0.45rem" >
                        <img src="__IMAGES__/activity/new/yes.png" class="img2" >           
                        </a>
                        <?php }elseif($is_change_img && $is_change_name && $count_topic){ ?>
                        <a class="li_a" style="top:0.45rem" id="cl" >
                            <img src="__IMAGES__/activity/new/no.png" class="img1" >
                        </a>
                        <?php }else{ ?>
                        <a onclick="show()" class="li_a" style="top:0.45rem" >
                            <img src="__IMAGES__/activity/new/no.png" class="img1" >
                        </a>
                        <?php } ?>
                    </div>
                </div>
            </section>
            <div id="message" style='display:none'>完成全部任务才能领奖哦~</div>
        </div>


        <script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
        <script>
                    //点击事件：                 
                    function show(){
                        var oMes = document.querySelector("#message");
                        oMes.style.display = "block";
                        setTimeout(function(){
                            oMes.style.display = "none";

                        },1000)
                    }
                    


                
                    /* 左右滑动事件，不影响上下滚动 */
                    var xx,yy,XX,YY,swipeX,swipeY ;
                    document.addEventListener('touchstart',function(event){
                         event.stopPropagation();//阻止冒泡
                         xx = event.targetTouches[0].screenX ;
                         yy = event.targetTouches[0].screenY ;
                         swipeX = true;
                         swipeY = true ;
                    })
                    document.addEventListener('touchmove',function(event){
                          XX = event.targetTouches[0].screenX ;
                          YY = event.targetTouches[0].screenY ;
                          if(swipeX && Math.abs(XX-xx)-Math.abs(YY-yy)<0)  //左右滑动
                          {

                              event.stopPropagation();//阻止冒泡
                              if( XX-xx<0 && YY-yy>0 ){
                                    window.location.reload();
                              }
                              swipeY = false ;
                          }
                          else if(swipeY && Math.abs(XX-xx)-Math.abs(YY-yy)<0){
                              //上下滑动，使用浏览器默认的上下滑动
                              swipeX = false ;
                          }
                    })
                    document.addEventListener('touchend',function(event){
                         event.stopPropagation();//阻止冒泡
                    })
















                    $(function() {

                        $('#cl').on('click', _click=function() {
                            var url = "http://" + window.location.host + "/Activity/receiveCoupon";
                            var mobile = '<?php echo $mobile;?>';
                            var user_name = '<?php echo $user_name;?>';
                            var uid = '<?php echo $uid;?>';
                            $.ajax ({
                                type: 'get',
                                url:  url + '?user_name='+ user_name+"&mobile="+mobile+"&uid="+uid+"&activity_flag=1" ,
                                dataType: 'json',
                                timeout: 6000,
                                beforeSend: function() {
                                    // 禁用按钮防止重复提交,
                                    $(document).off('click', _click);
                                },
                                success: function(data) {
                                    console.log(data);
                                    if (data.code == 200) {
                                        $('#cl img').attr('src','__IMAGES__/activity/new/yes.png');
                                        $("#message").html(" 领取成功").show();
                                        setTimeout(function () {
                                            $("#message").hide();
                                        }, 1000)

                                        $('#cl').off();
                                    }

                                    else if (data.code != 200) {

                                        $("#message").html("领取失败").show();                                       
                                        setTimeout(function () {
                                            $("#message").hide();
                                        }, 1000)

                                    }
                                }


                            });
                        })
                    })
        </script>
        <script>





            //rem自适应代码
                    (function(doc, win) {
                        var docEl = doc.documentElement,
                                resizeEvt = 'onorientationchange' in window ? 'onorientationchange' : 'resize',
                                recalc = function() {
                                    var clientWidth = docEl.clientWidth;
                                    if (!clientWidth)
                                        return;
                                    if (clientWidth >= 750) {
                                        docEl.style.fontSize = '100px';
                                    } else {
                                        docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';
                                    }
                                };

                        if (!doc.addEventListener)
                            return;
                        win.addEventListener(resizeEvt, recalc, false);
                        doc.addEventListener('DOMContentLoaded', recalc, false);
                    })(document, window);
        </script>
    </body>
</html>